public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}


class Solution {
    public String reverseStr(String s, int k) {
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < s.length(); i += 2 * k) {
            int right =  Math.min(i + k, s.length()) - 1;
            for (int j = right; j >= i; j--) {
                stringBuilder.append(s.charAt(j));
            }
            for (int j = right + 1; j < Math.min(s.length(), right + k + 1); j++) {
                stringBuilder.append(s.charAt(j));
            }
        }
        return stringBuilder.toString();
    }
}